<%@ page language="java" contentType= "text/html" pageEncoding="UTF-8"%>
<%@include file="/include/common/formuihead1.jsp"%>
<%@include file="/include/common/formuihead2.jsp"%>
<%
	page1.getPageTitle().setTitle("表單頁面demo");
	page1.setHelpURL("業務/預估系統/操作手冊/打樣系統1.0操作手冊.doc");
	Map saveOption = new LinkedHashMap();
	//第一种方式
	saveOption.put("保存1","{id:'save1',value:'save1',disabled:'false',confirm:'true'}");
	
	saveOption.put("保存2","save2");
	
	//第二种方式
	MenuOption save3MunuOption = new MenuOption();
	save3MunuOption.setId("save3");
	save3MunuOption.setValue("save3");
	save3MunuOption.setDisabled("true");
	saveOption.put("保存3",save3MunuOption);
%>
<jm:form>
<jm:layout postion="north">
	<jm:toolbar exportDisabled="true" saveOption="<%=saveOption%>" />
	<jm:pageTitle />
	<jm:error/>
</jm:layout>
<jm:layout postion="center">
	<jm:dp id="dp1" data="<%=Utils.TAG_FORM%>" tabSize="1" >
		<jm:tab colModel="50%;50%;">
			<jm:group caption="radio" id="group1" colspan="2">
				<jm:radio caption="計酬方式" required="true" name="jobCode1" enab="false" codeList="1|計件工人;2|計件幹部;3|計時工人;4|計時幹部" />	
			</jm:group>
			<jm:group caption="checkbox" >
				<jm:checkbox caption="計酬方式" name="jobCode2" enab="false" codeList="1|計件工人;2|計件幹部;3|計時工人;4|計時幹部"  />	
			</jm:group>
			<jm:group caption="select" >
				<jm:select caption="計酬方式" name="jobCode3" enab="false" codeList="1|計件工人;2|計件幹部;3|計時工人;4|計時幹部"  />	
			</jm:group>
			
			<jm:group caption="工號跳姓名">
				<jm:field caption="工號" required="true" name="hrnum">
					<input caption="工號" name="hrnum"  type="text" onblur="ajax_hrnum1(this);return false;"/><span id="chname" style="color: red"></span>
				</jm:field>
			</jm:group>
			<jm:group caption="部門點擊事件">
				<jm:field caption="部門">
					<jm:org caption="部門" name="org" onPicked="orgPicked" width="150px" subOrg="true" /><span id="orgtext" style="color: red"></span>
					<span id="test" bind="true" params="test,hrnum">-%1$s-----%2$s-</span>
				</jm:field>
			</jm:group>
			
			<jm:group caption="代理商跳客户">
				<jm:select caption="代理商" name="agt_no" width="150px" utils="<%=utils%>" dataSource="info6" sql="select agt_no,agt from js_system..wprg_agt order by agt"  />
				<jm:combobox caption="客戶" name="cus_no"  width="150px" jumpConfig="parentid:'agt_no',paramsfun:paramsfun_cus_no,dataSource:'info6',sql:'select cus_no,cus from js_system..wprg_agt_cust where agt_no = \\'%1$s\\' '" />
			</jm:group>
			
			<jm:group caption="普通combox(靜態數據源)" >
				<jm:combobox caption="計酬方式" name="combox_jobCode" codeList="1|計件工人;2|計件幹部;3|計時工人;4|計時幹部" width="150px" />	
			</jm:group>
			
			<jm:group caption="普通combox(動態數據源)" >
				<jm:combobox  caption="工號1(combox)" name="combox_hrnum"   width="150px"  config="maxSize:2"  single="true"  textConfig="format:'%1$s||%2$s||%3$s',params:'value,text,chfullname'"  utils="<%=utils%>"  dataSource="info5" sql="select a.hrnum,a.chname,e.chfullname from hr..hr005 a join hr..hr003 e on a.hr003id=e.hr003id where a.hrnum like '0%' and a.leaveday='' order by e.chfullname " />
			</jm:group>
			
			<jm:group caption="普通combox(動態數據源) 不带下拉" >
				<jm:combobox  caption="工號2(combox)" name="combox_hrnum"  width="180px"  noButton="true" config="maxSize:200"  textConfig="format:'%1$s||%2$s||%3$s',params:'value,text,chfullname'"  utils="<%=utils%>"  dataSource="info5" sql="select a.hrnum,a.chname,e.chfullname from hr..hr005 a join hr..hr003 e on a.hr003id=e.hr003id where a.hrnum like '0%' and a.leaveday='' order by e.chfullname " />
			</jm:group>
			
			<jm:group caption="普通combox(動態數據源) 带onpicked事件"  >
				<jm:field caption="工號3(combox)">
					<jm:combobox  caption="工號3(combox)" name="combox_hrnum" config="maxSize:200,onpicked:hrnum_onpicked,acwidth:200"  textConfig="format:'%1$s||%2$s||%3$s',params:'value,text,chfullname'"  utils="<%=utils%>"  dataSource="info5" sql="select a.hrnum,a.chname,e.chfullname from hr..hr005 a join hr..hr003 e on a.hr003id=e.hr003id where a.hrnum like '0%' and a.leaveday='' order by e.chfullname " />				
					<span id="combox_hrnum_span" style="color: red;"></span>
				</jm:field>
			</jm:group>
			
			<jm:group caption="日期帶時間">
				<jm:calendar name="date1" caption="日期" calConfig="dateFmt:'yyyy-MM-dd HH:mm'" width="150px"/>
			</jm:group>
			
			<jm:group caption="小数点保留2位(event)">
				<input caption="數字1" name="num1" event="blur" type="text" rule="number:2" />
			</jm:group>
			
			<jm:group caption="只可输入数字">
				<input caption="數字2" name="num2" event="blur,save" type="text" rule="digits:true" vfail="alert('fail')" vsucc="alert('succ')" />
			</jm:group>
			
			<jm:group caption="范围0-10">
				<input caption="數字3" name="num3" type="text" rule="range:[0,10]" />
			</jm:group>
			
			<jm:group caption="最小值10">
				<input caption="數字4" name="num4" type="text" rule="min:10" />
			</jm:group>
			
			<jm:group caption="最大值100">
				<input caption="數字5" name="num5" type="text" rule="max:100" />
			</jm:group>
			
			<jm:group caption="最少2个字符">
				<input caption="字符1" name="str1" type="text" rule="minlength:2" />
			</jm:group>
			
			<jm:group caption="最多6个字符">
				<input caption="字符2" name="str2" type="text" rule="maxlength:6" />
			</jm:group>
			
			<jm:group caption="允许输入的字符数范围 1-3">
				<input caption="字符3" name="str3" type="text" rule="rangelength: [1, 3] " />
			</jm:group>
		</jm:tab>
	</jm:dp>
	<jm:dp id="dp3" data="<%=Utils.TAG_FORM%>" customtab="假單">
		<jm:tab src="grid3.jsp" height="300px" width="100%" id="qj" />
	</jm:dp>
</jm:layout>

<jm:layout postion="south" />
</jm:form>
<jm:script><script type="text/javascript" charset="UTF-8">
	//工号跳姓名
	function ajax_hrnum1(_me){
		if($(_me).val() == '')return true ;
		
		var p = {};
		p['action'] = "ajax_hrnum";
		p['hrnum'] = $(_me).val();
		
		var doaction = function(jo){
			 if(jo != undefined && jo.ret == 1 && jo.data){
			 	var data = jo.data ;
			 	$('#chname').text(data['chname']);
			 }
		};
		
		$P.ajax({data : p,succ :doaction,isValidate:true});
	}
	
	function orgPicked(ret){
		//ret.text 部门中文
		//ret.value 部门tsn
		//console.log(ret);
		$('#orgtext').text(ret.text+'---------'+ret.value);
	}
	
	function hrnum_onpicked(ret){
		$('#combox_hrnum_span').text('工号:'+ret.value1);
	}
	
	//加载其它的参数
	function paramsfun_cus_no(ret){
		//console.log(ret);
	}
</script></jm:script>
<%@include file="/include/common/formuiend.jsp"%>